package com.tedu.enmybatis1.mapper;

import com.tedu.enmybatis1.pojo.Product;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProductMapper {
    @Insert("INSERT INTO product (title,price,stock) VALUES (#{title},#{price},#{stock})")
    int insert(Product product);

    @Select("SELECT id,title,price,stock FROM product WHERE id=#{id}")
    Product findById(Integer id);

    @Delete("DELETE FROM product WHERE id=#{id}")
    int deleteById(Integer id);

    @Select("SELECT id,title,price,stock FROM product")
    List<Product> find();
}
